import request from '@/utils/request'
export function getLessonList() {
  return request({
    method: 'get',
    url: '/v1_0/user/channels'
  })
}
export function getArticle(id, timestamp) {
  return request({
    method: 'get',
    // url: '/v1_0/articles',
    url: '/v1_1/articles',
    params: {
      channel_id: id,
      timestamp,
      with_top: 1
    }
  })
}
export function dislikeArticle(id) {
  return request({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target: id
    }
  })
}
export function reportArticle(id, type) {
  return request({
    method: 'post',
    url: '/v1_0/article/reports',
    data: {
      target: id,
      type
    }
  })
}
export const getAllChannelList = () => {
  return request({
    method: 'get',
    url: '/v1_0/channels'
  })
}
/**
 * 添加频道
 * @param {*} channels
 * @returns
 */
export function addChannel(channels) {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/channels',
    data: {
      channels
    }
  })
}
/**
 * 删除频道
 * @param {*} id
 * @returns
 */
export function delChannel(id) {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/channels/${id}`
  })
}
